from typing import List

def heap_sort(arr: List[int]) -> List[int]:
    """堆排序实现"""
    def heapify(arr, n, i):
        largest = i
        l = 2 * i + 1
        r = 2 * i + 2
        if l < n and arr[i] < arr[l]:
            largest = l
        if r < n and arr[largest] < arr[r]:
            largest = r
        if largest != i:
            arr[i], arr[largest] = arr[largest], arr[i]
            heapify(arr, n, largest)
    n = len(arr)
    for i in range(n//2 - 1, -1, -1):
        heapify(arr, n, i)
    for i in range(n-1, 0, -1):
        arr[i], arr[0] = arr[0], arr[i]
        heapify(arr, i, 0)
    return arr

# 测试代码
if __name__ == "__main__":
    # 示例输入
    input_array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]
    # 调用堆排序函数
    sorted_array = heap_sort(input_array)
    # 输出排序结果
    print("排序前的数组:", input_array)
    print("排序后的数组:", sorted_array)